Skip to content

Honor ts-ignore directives on multiline JSX in dependencies - #4721

Draft
jakebailey with Copilot wants to merge 3 commits into
mainfrom
copilot/resolve-type-errors-in-external-library
Draft

Honor ts-ignore directives on multiline JSX in dependencies#4721
jakebailey with Copilot wants to merge 3 commits into
mainfrom
copilot/resolve-type-errors-in-external-library

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

tsgo reported JSX attribute errors from dependency source files that tsc suppressed. The diagnostics occurred below an @ts-ignore attached to the JSX opening element.

// @ts-ignore
<Component
    invalidProp=""
>
    <Child />
</Component>

Changes

  • Extend directive matching for JSX diagnostics with semantic children to also inspect the line preceding the opening element.
  • Preserve existing line-based behavior for other diagnostics.
  • Add regression coverage for line and JSX-comment directives in a package loaded through node_modules.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix tsgo type errors in external-library source files Honor ts-ignore directives on multiline JSX in dependencies Jul 23, 2026
Copilot AI requested a review from jakebailey July 23, 2026 19:03
Comment thread internal/compiler/program.go Outdated
break
startLines := []int{scanner.ComputeLineOfPosition(lineStarts, diagnostic.Pos()) - 1}
if openingElement := getJsxOpeningElementForDiagnostic(sourceFile, diagnostic.Pos()); openingElement != nil {
openingElementLine := scanner.ComputeLineOfPosition(lineStarts, openingElement.TagName().Pos()) - 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot What the heck is this code? I don't recognize it from Strada.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right; it wasn't from Strada. I removed it in 00ced4f. The actual divergence was Corsa sorting the synthetic JSX children property after explicit attributes, while Strada's insertion-ordered spread checks children first and places this diagnostic on the opening tag. The replacement aligns that checker ordering and leaves directive filtering unchanged.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tsgo reports type errors in external-library (node_modules) source files that tsc suppresses

2 participants